<template>
  <div class="box">
    <div class="header">
    <router-link :to="'/personcenter/'+userId">
      <img :src="userHeader" alt="" />
    </router-link>
    </div>
    <div class="mess">
      <p>{{ userName }}<a href="javascript:;" @click="addFans" v-if="userId!=s">+</a></p>
      <p style="font-size: 10px">{{ userMess }}</p>
    </div>
  </div>
</template>

<script>
export default {
  props: ["userId", "userName", "userMess", "userHeader"],
  data(){
      return{
          isMy:false,
          s:null,
      }
  },
  methods:{
    addFans(){
      this.$http.put("/fans/addfans/"+this.userId).then(va => {
        if(va!=null){
          this.$alert(va.data.message)
        }
      })
    }
  },
  created() {
    // 判断该帖是否是自己的
    var bc = sessionStorage.getItem("BC");
    if (bc != null) {
      // 账号解密
      var bid = window.atob(window.atob(bc));
      this.s=bid
    }
  },
};
</script>

<style scoped lang="less">
.box {
  width: 100%;
  height: 65px;
  padding: 10px;
  .header {
    float: left;
    img {
      width: 45px;
      border-radius: 50%;
    }
  }
  .mess {
    margin-left: 10px;
    font-size: 15px;
    float: left;
    padding-top: 5px;
    p {
      font-family: ht;
      line-height: 20px;
      a {
        display: inline-block;
        width: 30px;
        height: 15px;
        background: #ffcd35;
        border-radius: 10px;
        margin-left: 5px;
        text-align: center;
        line-height: 15px;
      }
    }
  }
}
</style>